package com.ff.xyh.consumer.online.user.config;

import java.util.HashMap;
import java.util.Map;

/**
 * @Auther FF
 * @Date 2022年 12月 04日
 * @Time 17:13
 */

public class MyLock {

    private static final Map<String, MyLock> locks = new HashMap<>();

    public static Map<String, MyLock> getLocks() {
        return locks;
    }

    public MyLock (String id) {
        locks.put(id, this);
    }

    public synchronized void waitForConfirm(long timeout) throws InterruptedException {
        this.wait(timeout);
        return ;
    }
    public synchronized void confirmed () {
        this.notify();
    }
}
